import DAO.DatabasePool;
import controller.TestUtil;
import rdbms.RDBMSFTRelationTimeDAO;
import model.ConnectionProperty;
import model.FTRelationTime;


public class Main {

	public static void main(String[] args) throws Exception {
		
		ConnectionProperty conn;
		String dbId = "";
		String jobId = "FTEntityDAOTest";
		String connectionId = "1";
		
		try {
			
			conn = new ConnectionProperty(jobId, connectionId,
					TestUtil.Drivers.POSTGRE.getDriver(), TestUtil.Drivers.POSTGRE.getUrl(),
					TestUtil.Drivers.POSTGRE.getUser(), TestUtil.Drivers.POSTGRE.getPassword(),
					TestUtil.Drivers.POSTGRE.getSchema());
			DatabasePool.create(conn);
			dbId = conn.getId();
			
			//rdbmsFactory = DAOFactoryRDBMS.getDAOFactory(DAOFactoryRDBMS.FACTORY_TYPE.GENERIC_RDBMS);
			
			//sequence = rdbmsFactory.getENSequenceDAO(dbId);
			DatabasePool.setAutoCommit(dbId, false);
			FTRelationTime relationTime = new FTRelationTime();
			RDBMSFTRelationTimeDAO dao = new RDBMSFTRelationTimeDAO(dbId);

			
			relationTime.setCorrelationStrength(10);
			relationTime.setAssociationStrength(20);
			relationTime.setJoinFrequency(30);
			relationTime.setRelationId(1);
			relationTime.setSourceId(2);
			relationTime.setTargetId(3);
			relationTime.setTimeId(1);
			
			dao.insert(relationTime);
			
			
			
			
		} catch (Exception e) {
			throw e;
		} finally {
			DatabasePool.rollback(dbId);
			DatabasePool.setAutoCommit(dbId, true);
			DatabasePool.close(dbId);
		}

	}

}
